/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package unc.pds.facets;

import unc.pds.model.Model;
import unc.pds.model.Postable;
import unc.pds.model.UserRemote;

/**
 *
 * @author Mikhail
 */
public class AddPostFacet implements Facet {
    public AddPostFacet(Model user) {
        this.user = user;
    }
    private Model user;
    public String draw() throws Exception {
        String result = "";
        result += "<h4>Новая запись:</h4>\n";
        result += "<form action=\"post-processor.jsp\" method=\"post\" onsubmit=\"return validateEmpty('title','content');\">\n";
        result += "<input type=\"hidden\" name=\"userid\" value=\"" + user.getKey() + "\"/>\n";
        result += "<p><input type=\"text\" name=\"title\" id=\"title\"/></p>\n";
        result += "<p><textarea name=\"content\" cols=\"30\" rows=\"5\" id=\"content\"></textarea></p>\n";
        result += "<p><input type=\"submit\" value=\"Добавить\"/></p>\n";
        result += "</form>\n";
        return result;
    }
    public boolean isSide() {
        return false;
    }
}
